/**
 * Created by Administrator on 2017/7/13.
 */
import  jsonp from 'common/js/jsonp'
import {commonParams, options} from './config.js'
import axios from 'axios'
 // 获取banner数据
export  function getRecommend () {
  const url = 'https://c.y.qq.com/musichall/fcgi-bin/fcg_yqqhomepagerecommend.fcg'
  const data = Object.assign({}, commonParams, {
    platform: 'h5',
    uin: 0,
    needNewCode: 1
  })
  return jsonp(url, data, options)
}
 // 获取歌曲列表数据
export function  getDiscList() {
  const  url = '/api/getDiscList'
  const data = Object.assign({}, commonParams, {
    platform: 'yqq',
    hostUin: 0,
    categoryId: 10000000,
    sin: 0,
    ein: 29,
    sortId: 5,
    needNewCode: 0,
    rnd: Math.random(),
    format: 'json'
  })
  return axios.get(url, {
    params: data
  }).then((res) => {
    return Promise.resolve((res.data))
    })
}

 // 获取歌单详情数据
export function getSongList(disstid) {
  const url = '/api/getDetial'
  const data = Object.assign({}, commonParams, {
    type: 1,
    disstid,
    utf8: 1,
    onlysong: 0,
    platform: 'yqq',
    hostUin: 0,
    needNewCode: 0,
    g_tk: 67232076
  })
  return axios.get(url, {
    params: data
  }).then((res) => {
    return Promise.resolve((res.data))
  })
}
